package com.kungkhies.mvc;

import javax.servlet.http.HttpServletResponse;

import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.kungkhies.domain.kungkher.Kungkher;

@Controller
@RequestMapping(value = "/things")
public class ThingController
{
    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    public @ResponseBody
    Kungkher createThing(@RequestBody Kungkher kungkher, HttpServletResponse response)
    {
        System.out.println("GOT A KUNGKHER:  " + kungkher.getKungkherName());
        response.setHeader("Location", "http://www.kungkhies.com/foo/bar");
        return kungkher;
    }
}
